package com.itheima.dao;

import com.github.pagehelper.Page;
import com.itheima.pojo.CheckGroup;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface CheckGroupDao {

    public void add(CheckGroup checkGroup);

    public void setCheckGroupAndCheckItem(Map map);

    public Page<CheckGroup> findByCondition(String queryString);

    @Select("select * from t_checkgroup where id=#{id}")
    public CheckGroup findById(Integer id);

    @Select("select checkitem_id from t_checkgroup_checkitem where checkgroup_id=#{id}")
    public List<Integer> findCheckItemIdsByCheckGroupId(Integer id);

    public void edit(CheckGroup checkGroup);

    @Delete("delete from t_checkgroup_checkitem where checkgroup_id = #{id}")
    public void deleteAssocication(Integer id);

    @Select("select * from t_checkgroup")
    public List<CheckGroup> findAll();

    @Delete("delete from t_checkgroup where id=#{id}")
    public void deleteById(Integer id);

    @Select("select count(*) from t_setmeal_checkgroup where checkgroup_id = #{checkgroup_id}")
    public long findCountCheckGroupId(Integer id);
}
